﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TrabiBT
{
    class App
    {
        private static App appHandler;
        private Session currentSess;
        private MainWindow mainForm;
        private string portName = "COM6";

        public static App Instance
        {
            get { return appHandler; }
        }
        public Session CurrentSession
        {
            get { return currentSess; }
        }

        public MainWindow MainForm
        {
            get { return this.mainForm; }
        }
        public string PortName
        {
            get { return portName; }
            set { portName = value;}
        }

        public static void Initialize(MainWindow form)
        {
            appHandler = new App();
            appHandler.mainForm = form;
            
        }

        public void StartSession()
        {
            currentSess = new Session();
        }
        public void EndSession()
        {
        }
        /* Function to hadnle settings */
        public void ModifySettings()
        {
            SettingsForm settingsForm = new SettingsForm();
            /* Load settings */
            settingsForm.Port = portName;
            if (settingsForm.ShowDialog() == DialogResult.OK)
            {
                PortName = settingsForm.Port;
            };
        }

    }
}
